package com.newtouch.bxzs.enterprise.controller;

import com.newtouch.bxzs.common.base.response.BaseResponse;
import com.newtouch.bxzs.common.base.response.RespGenerator;
import com.newtouch.bxzs.enterprise.model.bo.BankCustomerAnalysisBO;
import com.newtouch.bxzs.enterprise.model.bo.InsuranceCustomerAnalysisBO;
import com.newtouch.bxzs.enterprise.model.vo.CustomerAnalysisVO;
import com.newtouch.bxzs.enterprise.service.CustomerAnalysisService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 提供保险/银行调对端查询客户分析信息接口Controller
 *
 * <p>
 * <b>History:</b>
 * <table border="1">
 * <tr>
 * <th>Date</th>
 * <th>Operator</th>
 * <th>Memo</th>
 * </tr>
 * <tr>
 * <td>2021/3/23 10:04</td>
 * <td>dingqianbin</td>
 * <td>Create</td>
 * </tr>
 * </table>
 *
 * @author dingqianbin
 * @version 1.0.0
 * @since 1.0.0
 */
@Api(tags = "客户分析")
@RestController
@RequestMapping(value = "/customerAnalysisController")
@SuppressWarnings("unchecked")
public class CustomerAnalysisController {

    private static final Log logger = LogFactory.getLog(CustomerAnalysisController.class);

    @Autowired
    private CustomerAnalysisService customerAnalysisService;

    /**
     * 银行端调保险端查询保险客户分析信息接口
     *
     * @param customerAnalysisVO 客户分析信息查询VO
     * @return 保险客户分析信息返回BO
     */
    @ApiOperation(value = "银行端调保险端查询保险客户分析信息接口")
    @PostMapping("/getInsuranceCustomerAnalysisInfo")
    public BaseResponse<InsuranceCustomerAnalysisBO> getInsuranceCustomerAnalysisInfo(@RequestBody CustomerAnalysisVO customerAnalysisVO) {
        logger.info("银行端调保险端查询保险客户分析信息");
        return RespGenerator.returnOK(customerAnalysisService.getInsuranceCustomerAnalysisInfo(customerAnalysisVO));
    }

    /**
     * 保险端调银行端查询银行客户分析信息接口
     *
     * @param customerAnalysisVO 客户分析信息查询VO
     * @return 银行客户分析信息返回BO
     */
    @ApiOperation(value = "保险端调银行端查询银行客户分析信息接口")
    @PostMapping("/getBankCustomerAnalysisInfo")
    public BaseResponse<BankCustomerAnalysisBO> getBankCustomerAnalysisInfo(@RequestBody CustomerAnalysisVO customerAnalysisVO) {
        logger.info("查看银行客户分析信息");
        return RespGenerator.returnOK(customerAnalysisService.getBankCustomerAnalysisInfo(customerAnalysisVO));
    }
}
